﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimpleFileManager.Manager
{
    public class FilePanelItemComposite : FilePanelItem
    {
        private int _count;
        List<IFilePanelItem> _items = new List<IFilePanelItem>();

        public FilePanelItemComposite()
            : base("")
        {
        }

        public string Name
        {
            get
            {
                if (Count == 1)
                {
                    return _items[0].Name;
                }
                else
                {
                    return "";
                }
            }
        }

        public override long Size
        {
            get { return 0; }
        }

        public override DateTime LastAccessTime
        {
            get { return DateTime.MinValue; }
        }

        public override int Count
        {
            get
            {
                return _count;
            }
        }

        public override void Add(IFilePanelItem item)
        {
            _items.Add(item);
            _count++;
        }

        public override void Remove(IFilePanelItem item)
        {
            _items.Remove(item);
            _count--;
        }

        public override void Copy(string path)
        {
            foreach (FilePanelItem item in _items)
            {
                item.Copy(path);
            }
        }

        public override void Delete()
        {
            foreach (FilePanelItem item in _items)
            {
                item.Delete();
            }
        }

        public override void Move(string path)
        {
            foreach (FilePanelItem item in _items)
            {
                item.Move(path);
            }
        }

        public override void Create(string name)
        {
        }

        public override void MakeAction(Manager.FileManager.FilePanel filePanel)
        {
        }

        public override void Rename(string newName)
        {
        }

    }
}
